using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Framework_Http_HttpDownloader_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Framework.Http.HttpDownloader);
            args = new Type[]{};
            method = type.GetMethod("get_uri", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_uri_0);
            args = new Type[]{};
            method = type.GetMethod("get_url", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_url_1);
            args = new Type[]{typeof(System.String)};
            method = type.GetMethod("set_url", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_url_2);
            args = new Type[]{};
            method = type.GetMethod("get_DownloadBytes", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_DownloadBytes_3);
            args = new Type[]{};
            method = type.GetMethod("get_Progress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Progress_4);
            args = new Type[]{};
            method = type.GetMethod("Reset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Reset_5);

            field = type.GetField("savePath", flag);
            app.RegisterCLRFieldGetter(field, get_savePath_0);
            app.RegisterCLRFieldSetter(field, set_savePath_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_savePath_0, AssignFromStack_savePath_0);
            field = type.GetField("code", flag);
            app.RegisterCLRFieldGetter(field, get_code_1);
            app.RegisterCLRFieldSetter(field, set_code_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_code_1, AssignFromStack_code_1);
            field = type.GetField("AutoRetry", flag);
            app.RegisterCLRFieldGetter(field, get_AutoRetry_2);
            app.RegisterCLRFieldSetter(field, set_AutoRetry_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_AutoRetry_2, AssignFromStack_AutoRetry_2);
            field = type.GetField("BreakpointResume", flag);
            app.RegisterCLRFieldGetter(field, get_BreakpointResume_3);
            app.RegisterCLRFieldSetter(field, set_BreakpointResume_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_BreakpointResume_3, AssignFromStack_BreakpointResume_3);
            field = type.GetField("Length", flag);
            app.RegisterCLRFieldGetter(field, get_Length_4);
            app.RegisterCLRFieldSetter(field, set_Length_4);
            app.RegisterCLRFieldBinding(field, CopyToStack_Length_4, AssignFromStack_Length_4);
            field = type.GetField("data", flag);
            app.RegisterCLRFieldGetter(field, get_data_5);
            app.RegisterCLRFieldSetter(field, set_data_5);
            app.RegisterCLRFieldBinding(field, CopyToStack_data_5, AssignFromStack_data_5);
            field = type.GetField("MainThreadCallback", flag);
            app.RegisterCLRFieldGetter(field, get_MainThreadCallback_6);
            app.RegisterCLRFieldSetter(field, set_MainThreadCallback_6);
            app.RegisterCLRFieldBinding(field, CopyToStack_MainThreadCallback_6, AssignFromStack_MainThreadCallback_6);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Framework.Http.HttpDownloader());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Framework.Http.HttpDownloader[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* get_uri_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.uri;

            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* get_url_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.url;

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* set_url_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.url = value;

            return __ret;
        }

        static StackObject* get_DownloadBytes_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.DownloadBytes;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* get_Progress_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Progress;

            __ret->ObjectType = ObjectTypes.Float;
            *(float*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* Reset_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HttpDownloader instance_of_this_method = (huqiang.Framework.Http.HttpDownloader)typeof(huqiang.Framework.Http.HttpDownloader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Reset();

            return __ret;
        }


        static object get_savePath_0(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).savePath;
        }

        static StackObject* CopyToStack_savePath_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).savePath;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_savePath_0(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).savePath = (System.String)v;
        }

        static StackObject* AssignFromStack_savePath_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @savePath = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Framework.Http.HttpDownloader)o).savePath = @savePath;
            return ptr_of_this_method;
        }

        static object get_code_1(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).code;
        }

        static StackObject* CopyToStack_code_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).code;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_code_1(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).code = (System.Int32)v;
        }

        static StackObject* AssignFromStack_code_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @code = ptr_of_this_method->Value;
            ((huqiang.Framework.Http.HttpDownloader)o).code = @code;
            return ptr_of_this_method;
        }

        static object get_AutoRetry_2(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).AutoRetry;
        }

        static StackObject* CopyToStack_AutoRetry_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).AutoRetry;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_AutoRetry_2(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).AutoRetry = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_AutoRetry_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @AutoRetry = ptr_of_this_method->Value == 1;
            ((huqiang.Framework.Http.HttpDownloader)o).AutoRetry = @AutoRetry;
            return ptr_of_this_method;
        }

        static object get_BreakpointResume_3(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).BreakpointResume;
        }

        static StackObject* CopyToStack_BreakpointResume_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).BreakpointResume;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_BreakpointResume_3(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).BreakpointResume = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_BreakpointResume_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @BreakpointResume = ptr_of_this_method->Value == 1;
            ((huqiang.Framework.Http.HttpDownloader)o).BreakpointResume = @BreakpointResume;
            return ptr_of_this_method;
        }

        static object get_Length_4(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).Length;
        }

        static StackObject* CopyToStack_Length_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).Length;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_Length_4(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).Length = (System.Int32)v;
        }

        static StackObject* AssignFromStack_Length_4(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @Length = ptr_of_this_method->Value;
            ((huqiang.Framework.Http.HttpDownloader)o).Length = @Length;
            return ptr_of_this_method;
        }

        static object get_data_5(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).data;
        }

        static StackObject* CopyToStack_data_5(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).data;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_data_5(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).data = (System.Byte[])v;
        }

        static StackObject* AssignFromStack_data_5(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Byte[] @data = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Framework.Http.HttpDownloader)o).data = @data;
            return ptr_of_this_method;
        }

        static object get_MainThreadCallback_6(ref object o)
        {
            return ((huqiang.Framework.Http.HttpDownloader)o).MainThreadCallback;
        }

        static StackObject* CopyToStack_MainThreadCallback_6(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HttpDownloader)o).MainThreadCallback;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_MainThreadCallback_6(ref object o, object v)
        {
            ((huqiang.Framework.Http.HttpDownloader)o).MainThreadCallback = (System.Action<huqiang.Framework.IMission>)v;
        }

        static StackObject* AssignFromStack_MainThreadCallback_6(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Action<huqiang.Framework.IMission> @MainThreadCallback = (System.Action<huqiang.Framework.IMission>)typeof(System.Action<huqiang.Framework.IMission>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.Framework.Http.HttpDownloader)o).MainThreadCallback = @MainThreadCallback;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Framework.Http.HttpDownloader();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
